import { Breadcrumb, Space } from 'antd';
import { FC } from 'react';
import { Link } from 'umi';
interface ICrumb {
  id: number;
  title: string;
  path?: string;
}
interface ICrumb {
  crumb: ICrumb[];
}
const Crumb: FC<ICrumb> = ({ crumb }) => {
  return (
    <div>
      <Space size="large">
        <Breadcrumb>
          <Breadcrumb.Item>
            <Link to="/">主页</Link>
          </Breadcrumb.Item>
          {crumb.map((item: any) => (
            <Breadcrumb.Item>
              {item.path ? (
                <Link key={item.id} to={item.path}>
                  {item.title}
                </Link>
              ) : (
                <span>{item.title}</span>
              )}
            </Breadcrumb.Item>
          ))}
        </Breadcrumb>
      </Space>
    </div>
  );
};

export default Crumb;
